AmCharts.AmFunnelChart=AmCharts.Class({inherits:AmCharts.AmSlicedChart,construct:function(t){this.chartType="funnel";AmCharts.AmFunnelChart.base.construct.call(this,t);this.startX=this.startY=0;this.baseWidth="100%";this.neckHeight=this.neckWidth=0;this.rotate=!1;this.valueRepresents="height";this.pullDistance=30;this.labelPosition="center";this.labelText="[[title]]: [[value]]";this.balloonText="[[title]]: [[value]]\n[[description]]";AmCharts.applyTheme(this,t,"AmFunnelChart")},drawChart:function(){AmCharts.AmFunnelChart.base.drawChart.call(this);var t=this.chartData;if(AmCharts.ifArray(t))if(0<this.realWidth&&0<this.realHeight){var a=this.container,e=this.startDuration,i=this.rotate,h=this.updateWidth();this.realWidth=h;var s=this.updateHeight();this.realHeight=s;var r=AmCharts.toCoordinate,l=r(this.marginLeft,h),n=r(this.marginRight,h),o=r(this.marginTop,s)+this.getTitleHeight(),r=r(this.marginBottom,s),n=h-l-n,d=AmCharts.toCoordinate(this.baseWidth,n),p=AmCharts.toCoordinate(this.neckWidth,n),c=s-r-o,C=AmCharts.toCoordinate(this.neckHeight,c),u=o+c-C;i&&(o=s-r,u=o-c+C);this.firstSliceY=o;AmCharts.VML&&(this.startAlpha=1);for(var g=n/2+l,m=(c-C)/((d-p)/2),b=d/2,d=(c-C)*(d+p)/2+p*C,C=o,A=0,f=0;f<t.length;f++){var v=t[f];if(!0!==v.hidden){var x=[],y=[],T;if("height"==this.valueRepresents)T=c*v.percents/100;else{var H=-d*v.percents/100/2,Y=b,L=-1/(2*m);T=Math.pow(Y,2)-4*L*H;0>T&&(T=0);T=(Math.sqrt(T)-Y)/(2*L);if(!i&&o>=u||i&&o<=u)T=2*-H/p;else if(!i&&o+T>u||i&&o-T<u)L=i?Math.round(T+(o-T-u)):Math.round(T-(o+T-u)),T=L/m,T=L+2*(-H-(Y-T/2)*L)/p}H=b-T/m;Y=!1;!i&&o+T>u||i&&o-T<u?(H=p/2,x.push(g-b,g+b,g+H,g+H,g-H,g-H),i?(L=T+(o-T-u),y.push(o,o,o-L,o-T,o-T,o-L,o)):(L=T-(o+T-u),y.push(o,o,o+L,o+T,o+T,o+L,o)),Y=!0):(x.push(g-b,g+b,g+H,g-H),i?y.push(o,o,o-T,o-T):y.push(o,o,o+T,o+T));a.set();L=a.set();x=AmCharts.polygon(a,x,y,v.color,v.alpha,this.outlineThickness,this.outlineColor,this.outlineAlpha);L.push(x);this.graphsSet.push(L);v.wedge=L;v.index=f;if(y=this.gradientRatio){var S=[],W;for(W=0;W<y.length;W++)S.push(AmCharts.adjustLuminosity(v.color,y[W]));0<S.length&&x.gradient("linearGradient",S);v.pattern&&x.pattern(v.pattern)}0<e&&(x=this.startAlpha,this.chartCreated&&(x=v.alpha),L.setAttr("opacity",x));this.addEventListeners(L,v);this.labelsEnabled&&this.labelText&&v.percents>=this.hideLabelsPercent&&(y=this.formatString(this.labelText,v),S=v.labelColor,S||(S=this.color),x=this.labelPosition,W="left","center"==x&&(W="middle"),"left"==x&&(W="right"),y=AmCharts.text(a,y,S,this.fontFamily,this.fontSize,W),L.push(y),S=g,i?(W=o-T/2,v.ty0=W):(W=o+T/2,v.ty0=W,W<C+A+5&&(W=C+A+5),W>s-r&&(W=s-r)),"right"==x&&(S=n+10+l,v.tx0=g+(b-T/2/m),Y&&(v.tx0=g+H)),"left"==x&&(v.tx0=g-(b-T/2/m),Y&&(v.tx0=g-H),S=l),v.label=y,v.labelX=S,v.labelY=W,v.labelHeight=y.getBBox().height,y.translate(S,W),(0===v.alpha||0<e&&!this.chartCreated)&&L.hide(),o=i?o-T:o+T,b=H,A=y.getBBox().height,C=W);v.startX=AmCharts.toCoordinate(this.startX,h);v.startY=AmCharts.toCoordinate(this.startY,s);v.pullX=AmCharts.toCoordinate(this.pullDistance,h);v.pullY=0;v.balloonX=g;v.balloonY=v.ty0}}this.arrangeLabels();this.initialStart();(t=this.legend)&&t.invalidateSize()}else this.cleanChart();this.dispDUpd();this.chartCreated=!0},arrangeLabels:function(){var t=this.rotate,a;a=t?0:this.realHeight;for(var e=0,i=this.chartData,h=i.length,s,r=0;r<h;r++){s=i[h-r-1];var l=s.label,n=s.labelY,o=s.labelX,d=s.labelHeight,p=n;t?a+e+5>n&&(p=a+e+5):n+d+5>a&&(p=a-5-d);a=p;e=d;l.translate(o,p);s.labelY=p;s.tx=o;s.ty=p;s.tx2=o}"center"!=this.labelPosition&&this.drawTicks()}});
//# sourceMappingURL=funnel.map.js